package com.maxmlr.framework.aop;

import com.google.common.collect.Maps;

import java.lang.reflect.Method;
import java.util.Map;

/**
 * @ClassName AopConfig
 * @Description TODO
 * @Author maxiao
 * @Date 2020/3/16 上午11:14
 * @Version V1.0
 */
public class AopConfig {

    //以目标对象需要增强的Method作为key，需要增强的代码内容作为value
    private Map<Method, Aspect> points = Maps.newHashMap();

    /**
     * 存入aop配置
     *
     * @param target 原生方法
     * @param aspect 代理切面对象
     * @param points 切面方法集
     */
    public void put(Method target, Object aspect, Method[] points) {
        this.points.put(target, new Aspect(aspect, points));
    }

    public Aspect get(Method method) {
        return this.points.get(method);
    }

    public boolean contains(Method method) {
        return this.points.containsKey(method);
    }

}
